<template>
  <div>
    <eagle-page-list
      ref="eaglePageList"
      @bindData="bindData"
      :queryParams="queryParams"
      :controller="controller"
      :conditions="conditions"
      placeholder="请输入公司搜索"
      :filterParams="filterParams"
      filterTab
      :filterTabDefaul="filterTabDefault"
      :pageSize="20"
    >
      <div slot="list">
        <eagle-cell
          style="margin-top: 10px"
          class="br-8"
          v-for="(item, index) in list"
          :key="index"
        >
          <div>
            <div @click="goToDetail(item)">
              <eagle-row
                gutter="15"
                style="word-break:break-all"
              >
                <eagle-col>
                  <b style="font-size: 13px">{{ "公司:"+item.EnterpriseName }}</b>
                </eagle-col>
              </eagle-row>
              <eagle-row gutter="15">
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_list_user.png"
                    alt=""
                  />年份：{{ item.Year }}
                </eagle-col>
              </eagle-row>
              <eagle-row gutter="20">
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_list_user.png"
                    alt=""
                  />录入人：{{ item.CreateChnName }}
                </eagle-col>
              </eagle-row>
              <eagle-row gutter="20">
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_list_date.png"
                    alt=""
                  />录入时间：{{item.CreateDate | formatDate }}
                </eagle-col>
              </eagle-row>
              <eagle-file-read-only
                :attachs="item.MainAttach"
                :labelName="'签名文件:'"
              ></eagle-file-read-only>
              <van-divider />
            </div>
            <div class="op_btn">
              <div
                class="btn_item"
                v-if="item.Status != -1"
                @click="del(item)"
              >
                <img
                  src="@/assets/Images/AppIcon/icon_list_abolish.png"
                  alt=""
                />
                <div class="mr-10">废止</div>
              </div>
            </div>
          </div>
        </eagle-cell>
      </div>
    </eagle-page-list>
  </div>
</template>

<script>
export default {
  data() {
    return {
      controller: "/ResponsibilityOrgPostUserDepositManage",
      conditions: {},
      list: [],
      queryParams: {
        dataType: "DepositCompanyManage",
        keywords: "",
      },
      filterTabDefault:[{ name: "Status", value: "10" }],
      filterParams: [
        {
          name: "Status",
          title: "状态",
          originTitle: "状态",
          dataType: "int",
          data: [
            { text: "不限", value: "" },
            { text: "现行", value: "10" },
            { text: "废止", value: "-1" },
          ],
        },
      ],
    };
  },
  methods: {
    bindData(data) {
      this.list = [];
      if (data) {
        this.list = data;
      }
    },
    goToDetail(item) {
      this.$router.push({
        path: "/CompanyProductionSafetyView",
        query: { id: item.ID },
      });
    },
    del(item) {
      const _this = this;
      const id = item.ID;
      this.$dialog
        .confirm({
          title: "询问",
          message: "您确定废止本条信息吗？",
        })
        .then(() => {
          _this.$axios.get("/ResponsibilityOrgPostUserDepositManage/Abolish",{params:{id}})
          .then((res) => {
            _this.$refs.eaglePageList.getList();
            //_this.change_tab_left();
          })
          .catch((err) => {
            console.log("err", err);
          });
        })
        .catch(() => {
          // on cancel
        });
    },
  },
};
</script>

<style lang="less" scoped>
.phone {
  position: relative;
  .code {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 12px;
  }
}
.register-info {
  background-color: #e8f1f8;
  padding-bottom: 20px;
}
.img-box {
  height: 50px;
  width: 50px;
  padding: 10px;
  position: absolute;
  left: 50%;
  top: 60px;
  background-color: #fff;
  border-radius: 50%;
  overflow: hidden;
}
.popup-title {
  line-height: 35px;
  padding: 10px;
  font-size: 15px;
  padding-left: 20px;
}

.op_btn {
  display: flex;
  justify-content: flex-end;
  .btn_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}

.search-box {
  height: 1rem;
}
</style>
